package com.arvin.controller;

import com.arvin.pojo.DataCount;
import com.arvin.pojo.Result;
import com.arvin.service.DataCountService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashSet;
import java.util.Map;

@RestController
@RequestMapping("/dataCount")
@Tag(name = "数据统计接口",description = "数据统计接口")
@Slf4j
public class DataCountController {
    @Autowired
    private DataCountService dataCountService;

    /**
     * 获取年级分类信息
     * @param className
     * @return
     */
    @Operation(summary = "获取年级分类信息",description = "获取年级分类信息")
    @GetMapping("/getInClassDivideByGrade")
    public Result<DataCount> getInClassDivideByGrade(String className){
        log.info("获取年级分类信息:{}",className);
        DataCount dataCount = dataCountService.getInClassDivideByGrade(className);
        return Result.success(dataCount);
    }

    /**
     * 获取统计人数
     * @param className
     * @return
     */
    @Operation(summary = "获取统计人数",description = "获取统计人数")
    @GetMapping("/getTotalData")
    public Result<Map> getTotalData(String className){
        log.info("获取统计人数:{}",className);
        Map result = dataCountService.getTotalData(className);
        return Result.success(result);
    }

    /**
     * 获取专业分布信息
     * @param className
     * @return
     */
    @Operation(summary = "获取专业分布信息",description = "获取专业分布信息")
    @GetMapping("/getInClassDivideBySpecial")
    public Result<DataCount> getInClassDivideBySpecial(String className){
        log.info("获取专业分布信息:{}",className);
        DataCount result = dataCountService.getInClassDivideBySpecial(className);
        return Result.success(result);
    }

    /**
     * 获取考试分数分布信息
     * @param className
     * @return
     */
    @Operation(summary = "获取考试分数分布信息",description = "获取考试分数分布信息")
    @GetMapping("/getExamScoreCount")
    public Result<DataCount> getExamScoreCount(String className){
        log.info("获取考试分数分布信息:{}",className);
        DataCount result = dataCountService.getScoreCount("t_exam", className);
        return Result.success(result);
    }

    /**
     * 获取考试状态分布信息
     * @param className
     * @return
     */
    @Operation(summary = "获取考试状态分布信息",description = "获取考试状态分布信息")
    @GetMapping("/getExamStateCount")
    public Result<DataCount> getExamStateCount(String className){
        log.info("获取考试状态分布信息:{}",className);
        DataCount result = dataCountService.getExamStateCount(className);
        return Result.success(result);
    }

    /**
     * 获取面试分数分布信息
     * @param className
     * @return
     */
    @Operation(summary = "获取面试分数分布信息",description = "获取面试分数分布信息")
    @GetMapping("/getIntvScoreCount")
    public Result<DataCount> getIntvScoreCount(String className){
        log.info("获取面试分数分布信息:{}",className);
        DataCount result = dataCountService.getScoreCount("t_interview", className);
        return Result.success(result);
    }

    /**
     * 获取面试状态分布信息
     * @param className
     * @return
     */
    @Operation(summary = "获取面试状态分布信息",description = "获取面试状态分布信息")
    @GetMapping("/getIntvStateCount")
    public Result<DataCount> getIntvStateCount(String className){
        log.info("获取面试状态分布信息:{}",className);
        DataCount result = dataCountService.getIntvStateCount(className);
        return Result.success(result);
    }

    /**
     * 获取所有卓越班级列表信息
     * @return
     */
    @Operation(summary = "获取所有卓越班级列表信息",description = "获取所有卓越班级列表信息")
    @GetMapping("/getAllClassName")
    public Result<HashSet<String>> getAllClassName(){
        log.info("获取所有卓越班级列表信息");
        HashSet<String> result = dataCountService.getAllClassName();
        return Result.success(result);
    }

    /**
     * 获取入班人员班级分布信息
     * @param className
     * @return
     */
    @Operation(summary = "获取入班人员班级分布信息",description = "获取入班人员班级分布信息")
    @GetMapping("/getInClassStudentClass")
    public Result<DataCount> getInClassStudentClass(String className){
        log.info("获取入班人员班级分布信息:{}",className);
        DataCount result = dataCountService.getInClassStudentClass(className);
        return Result.success(result);
    }

}
